package com.shexianyu.simple;

import java.util.Arrays;

public class Merge {

    public void merge(int[] nums1, int m, int[] nums2, int n) {
        int count = 0;
        for (int i = m; i < (m + n); i++) {
            for (int j = count; j < n; j++) {
                nums1[i] = nums2[j];
                break;
            }
            count++;
        }
        Arrays.sort(nums1);
    }

    public void merge1(int[] nums1, int m, int[] nums2, int n) {
        for (int i = 0; i != n; i++) {
            nums1[m + i] = nums2[i];
        }
        Arrays.sort(nums1);
    }
}
